package com.liCheng.service.provider;

import com.liCheng.dao.provider.ProviderMapper;
import com.liCheng.entity.Provider;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("providerService")
public class ProviderServiceImpl implements ProviderService {
    @Resource
    private ProviderMapper providerMapper;

    public ProviderMapper getProviderMapper() {
        return providerMapper;
    }

    public void setProviderMapper(ProviderMapper providerMapper) {
        this.providerMapper = providerMapper;
    }

    //显示所有的供应商数据
    @Override
    public List<Provider> findProviderWithConditions() {
        try {
            return providerMapper.ProList();//调用DAO方法实现查询
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }
    }

    //根据供应商名称模糊查询
    @Override
    public List<Provider> providerName1(String proName) {
        try {
            return providerMapper.providerName(proName);//调用DAO方法实现查询
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }
    }

    @Override
    public int proUpdateTest(Provider provider) {
        try {
            return providerMapper.proUpdate(provider);//调用DAO方法实现查询
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }
    }

    @Override
    public int proDelTest(int id) {
        try {
            return providerMapper.proDel(id);//调用DAO方法实现查询
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }
    }

}
